package l2hc.gameserver.handler.voicecommands.impl;

import l2hc.gameserver.Config;
import l2hc.gameserver.cache.Msg;
import l2hc.gameserver.handler.voicecommands.IVoicedCommandHandler;
import l2hc.gameserver.model.Player;
import l2hc.gameserver.network.serverpackets.SystemMessage;
import l2hc.gameserver.skills.skillclasses.Call;
import l2hc.gameserver.utils.Location;
/**
 * @author 4ipolino
 */
public class Relocate
  implements IVoicedCommandHandler
{
  private String[] _commandList = { "km-all-to-me" };

  public boolean useVoicedCommand(String command, Player activeChar, String target)
  {
    if (!Config.ENABLE_KM_ALL_TO_ME) 
    {
      return false;
    }
    if (!activeChar.isClanLeader())
    {
      activeChar.sendPacket(Msg.ONLY_THE_CLAN_LEADER_IS_ENABLED);
      return false;
    }

    SystemMessage msg = Call.canSummonHere(activeChar);
    if (msg != null)
    {
      activeChar.sendPacket(msg);
      return false;
    }

    for (Player player : activeChar.getClan().getOnlineMembers(activeChar.getObjectId())) {
      if (Call.canBeSummoned(player) == null)
        player.summonCharacterRequest(activeChar, Location.findAroundPosition(activeChar, 100, 150), 5);
    }
    return true;
  }

  public String[] getVoicedCommandList()
  {
    return this._commandList;
  }
}